<!DOCTYPE html>
<html>
<head>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script>
        if (document.location.hostname == "127.0.0.1") {
            document.location.hostname = "subdomain.example.test";
        } else {
            test(function () {
                document.domain = 'example.test';

                assert_throws_dom("SecurityError", function () {
                    new Worker("http://example.test/worker.js");
                });

                try {
                    new Worker("resources/non-existent.js");
                } catch (e) {
                    assert_unreached("Same-origin worker shouldn't throw.");
                }
            }, "SecurityError thrown when accessing another domain's worker.");
        }
    </script>
</head>
<body>
</body>
</html>
